package patrol.mobile.com.mobilepatrol.activity.security.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.dl7.recycler.adapter.BaseQuickAdapter;
import com.dl7.recycler.adapter.BaseViewHolder;
import com.dl7.recycler.helper.RecyclerViewHelper;

import java.util.ArrayList;
import java.util.List;

import patrol.mobile.com.mobilepatrol.R;

/**
 * Created by K on 2018/9/11.
 * des:
 */
public class EmergencyFestivalDuty2ListAdapter extends BaseQuickAdapter<String> {
//    private int currentItem = -1;
    private EmergencyFestivalDutyInnerAdapter emergencyFestivalDutyInnerAdapter;
    private List<String> innerList = new ArrayList<>();

    public EmergencyFestivalDuty2ListAdapter(Context context) {
        super(context);
        for (int i = 0; i < 5; i++) {
            innerList.add("123");
        }
    }

    @Override
    protected int attachLayoutRes() {
        return R.layout.item_emergency_festival_duty2_list;
    }

    @Override
    protected void convert(BaseViewHolder holder, String item) {
        RecyclerView innerRecyclerView = holder.getView(R.id.recyclerView);
        emergencyFestivalDutyInnerAdapter = new EmergencyFestivalDutyInnerAdapter(mContext,innerList);
        RecyclerViewHelper.initRecyclerViewV(mContext, innerRecyclerView,
                false, emergencyFestivalDutyInnerAdapter);
        innerRecyclerView.setAdapter(emergencyFestivalDutyInnerAdapter);
//        holder.setTag(R.id.iv_arror, holder.getAdapterPosition());


//        if (currentItem == holder.getAdapterPosition()) {
//            holder.setVisible(R.id.recyclerView, true);
//        } else {
//            holder.setVisible(R.id.recyclerView, false);
//        }
//
//        holder.setOnClickListener(R.id.iv_arror, new View.OnClickListener() {
//
//            @Override
//            public void onClick(View view) {
//                int tag = (int) view.getTag();
//                if (tag == currentItem) { //再次点击
//                    currentItem = -1; //给 currentItem 一个无效值
//                } else {
//                    currentItem = tag;
//                }
//                //通知adapter数据改变需要重新加载
//                notifyDataSetChanged(); //必须有的一步
//            }
//        });
    }
}
